package cn.zhejianglao.shirotemplate.exception;

/**
 * @author zefengwang
 */

public interface ExceptionCode {

    interface Param {
        int ILLEGAL_PARAM_CODE = 10001;
        String ILLEGAL_PARAM_MSG = "illegal parameter(s)";
        int NULL_PARAM_CODE = 10002;
        String NULL_PARAM_MSG = "入参为空";
    }

    interface System {
        int INTERFACE_NOT_EXIST_OR_REQUEST_MODE_ERROR_CODE = 90001;
        String INTERFACE_NOT_EXIST_OR_REQUEST_MODE_ERROR_MSG = "interface doesn't exist or invalid request";

        int SYSTEM_ERROR_CODE = 90002;
        String SYSTEM_ERROR_MSG = "system error";

        int CONVERT_ERROR_CODE = 90003;
        String CONVERT_ERROR_MSG = "json convert error";
    }

    interface Permission {
        int AUTHORIZATION_PARAM_CODE = 20001;
        int USERNAME_NOT_EXIST_CODE = 20002;
        String USERNAME_NOT_EXIST_MSG = "username doesn't exist";
        int AUTHENTICATION_FAILURE_CODE = 20003;
        String AUTHENTICATION_FAILURE_MSG = "authentication failure";
        int AUTHENTICATION_INCORRECT_PASSWORD_CODE = 20004;
        String AUTHENTICATION_INCORRECT_PASSWORD_MSG = "incorrect password";
        int USER_ALREADY_EXISTS_CODE = 20005;
        String USER_ALREADY_EXISTS_MSG = "user already exists";
        int ROLE_ALREADY_EXISTS_CODE = 20006;
        String ROLE_ALREADY_EXISTS_MSG = "role already exists";
        int PERMISSION_ALREADY_EXISTS_CODE = 20007;
        String PERMISSION_ALREADY_EXISTS_MSG = "permission already exists";
        int INSUFFICIENT_PERMISSION_CODE = 20008;
        String INSUFFICIENT_PERMISSION_MSG = "insufficient permission";
    }

    interface Runtime {
        int SQL_EXCEPTION_CODE = 30001;
        String SQL_EXCEPTION_MSG = "sql exception";
    }

    interface Common {
        int RESOURCE_NOT_EXISTS_CODE = 40001;
        String RESOURCE_NOT_EXISTS_MSG = "resource not exists";
        int RESOURCE_ALREADY_EXISTS_CODE = 40002;
        String RESOURCE_ALREADY_EXISTS_MSG = "resource already exists";
    }

    interface IO {
        int FAIL_TO_UPLOAD_FILE_CODE = 50001;
        String FAIL_TO_UPLOAD_FILE_MSG = "fail to upload a file";
        int FAIL_TO_MKDIR_CODE = 50002;
        String FAIL_TO_MKDIR_MSG = "fail to mkdir";
    }

    interface File {
        int FILE_NAME_TOO_LONG_CODE = 60001;
        String FILE_NAME_TOO_LONG_MSG = "file name is too long, max 100 chars";
        int FILE_NOT_EXISTS_CODE = 60002;
        String FILE_NOT_EXISTS_MSG = "file doesn't exist";
    }
}
